Chrono Compressor, v2.01 - 10/13/13
CC

Written by: imMUNEity (EnhasaEnhancements@gmail.com)
Re/decompression scheme reverse engineered by: Evil Peer



*(All hexadecimal numbers will be preceeded by "0x")


1. What's this program for?

  This utility comes in handy when editing spritesheets and tilesets in Chrono Trigger
  Actually, it would be useful when editing that stuff in any game, but the compression feature only works for Chrono Trigger

  Ordinarily, you would have to open the ROM with a hex editor, find the offset of the chunk you want to extract, and copy and paste it into
  a new ROM file.  Then you could edit however you like.  Putting it back would require finding the offset again, and making sure to paste
  your edit over exactly the same number of bytes so as not to screw up everything else.  Additionally, compressed pieces in Trigger
  would be un-editable.

  With this program, you can easily jump to a given offset, decompress it if necessary, and save that chunk to a file.
  When you are ready to reinsert it, you simply load it into the buffer, load the original ROM into CC, recompress (if necessary), and reinsert!
  All the overwriting and counting is done automatically, as is the compression.



2. How do I use this?  (Example useage.  Actually, this example is exactly the reason I wrote the program)

  Let's say you want to edit the overworld sprites.

  A) First, you have to load a Chrono Trigger ROM.  Go to File > Load ROM, and select a .smc file.

  B) The hexadecimal offsets for the OW spritesheet are 0x59A56 and 0x5B113.  First, make sure the Hex Mode button is clicked.  

  C) Then you would type "59a56" and "5b113" into "first byte" and "last byte", respectively.
     (It's not case-sensitive).

  D) Click "Extract to buffer".  This copies the designated subset of bytes into memory and displays the result in the textbox, and it allows the 
     subset to be decompressed

  E) The Overworld sprites are compressed, so click "Decompress".  Make a note of the "Buffer Size", that'll be important

  F) Next, save the buffer to a file (File > Save buffer)

  G) Now you can use another program to mess with the sprites (You'll need a sprite editor, or a program like Rom Graphix to convert the images 
     into editable bitmaps- it's available on Zophar's domain and/or romhacking.net, I think.  The Peer Sprite Viewer is also really helpful, and 
     it should also be available on one or both of those websites.  Email me if you want to hear how I went about editing sprites)

  H) Once you are happy with your new sprites, use Rom Graphix to convert the bitmap back into the SNES format (if that's how you edited them), 
     and change the file extension to ".smc"

  I) Load that .smc file into CC, and extract the whole thing to the buffer (offsets 0x0 to 0x2000 in this example).

  J) Click Recompress.  Now here's the tricky part- if the buffer size is greater than the one you made note of earlier (0x16BE in this case)
     then you will have to try again!  A larger subset will overwrite other parts of the ROM that you don't want to change, and that could
     make the ROM unplayable, or at least mess up some other random part of it.  In general, more contiguous whitespace and less color diversity
     results in a smaller compressed file size.

  K) Now, load your original ROM into CC.  DONT EXTRACT ANYTHING TO THE BUFFER or you will have to repeat steps I and J again.

  L) In case you mess up (or if there's a bug in CC that I don't know about) you should probably backup your original file.  If you want, CC
     can do it automatically when you hit Ctrl + B (or by going to File > Create Backup).  It'll take your original ROM and copy it, and append 
     either a timestamp or an index integer (depending on your settings) to the end of the copy's name

  M) set the "First Byte" to the first byte that you extracted (0x59A56 in this example).  It doesn't matter what you set as the last byte, CC
     just overwrites however many bytes it needs to in order to fit the entire buffer into the ROM.

  N) Click "Insert from Buffer".
     *Note: If you still havent backed up your original ROM, it's not too late- the changes aren't final until you save the ROM.

  O) Save your ROM: File > Save (or File > Save As).

  P) Test it out!  Pop it into ZSNES and see how everyone looks!  (Don't forget to rename your save states to the new ROM name)
     If the Epoch's OW sprite is screwy after this example, you probably inserted too big a file, as I'm pretty sure it's the epoch's OW sprites
     that follow the characters' sprites.



3. Troubleshooting and Random Questions

  I made the changes, but when I play the game they're not reflected!
    -You probably just need to leave the room and come back (or go inside and then exit if you're on the world map)
     The savestate remembers the original sprites, but they'll be gone once the room loads again

  What are Hex Mode and Dec Mode?
    -You have the option of entering offsets in Hexadecimal (Base 16) or Decimal (Base 10)

  The message that pops up whenever I switch between Hex and Dec modes is really annoying!
    -Go to Settings > Convert Offsets > Always Convert to skip the warnings and convert automatically, or Never Convert to leave the values as 
     they are

  What's that "NA Offsets" File?
    -That file contains all of the known locations of various pointers, spritesheets, tilesets, etc. within Chrono Trigger.  All of the Offsets are
     in hex, and that "Y" or "N" next to each of them tells you whether the chunk is compressed or not.  Basically, if you want to edit Chrono Trigger,
     that file is really useful.

  imMUNEity you stupid idiot, there's a bug in the program!
    -Whoops, my bad, I guess I missed something.  Shoot me an email, along with a copy of the ROM you were using and a description of the problem.
     My email is EnhasaEnhancements@gmail.com

  My problem's not covered here, help!
    -Again, shoot me an email! My address is right above here, and at the top of this readme as well.  I'm always happy to help a fellow Chrono
     Hacker!

  


